package com.youku.controls
{
   import flash.display.Sprite;
   import com.youku.FacadeManager;
   import com.youku.GlobalService;
   import com.youku.GlobalServiceKeys;
   import com.youku.ViewManager;
   import com.youku.interfaces.IPlayerProxy;
   import com.youku.conductor.Conductor;
   import com.youku.ExternalProxy;
   import com.youku.PlayerConfig;
   import com.youku.interfaces.IRootData;
   import com.youku.conductor.ConductorState;
   import com.youku.events.PlayerControlEvent;
   import com.youku.utils.OpenWindow;
   import flash.net.URLRequest;
   import com.youku.events.ReportEvent;
   
   public class BasePluginController extends Sprite
   {
      
      public function BasePluginController() {
         super();
      }
      
      protected function get facadeManager() : FacadeManager {
         return GlobalService.getService(GlobalServiceKeys.FACADE_MANAGER) as FacadeManager;
      }
      
      protected function get viewManager() : ViewManager {
         return GlobalService.getService(GlobalServiceKeys.VIEW_MANAGER) as ViewManager;
      }
      
      protected function get playerProxy() : IPlayerProxy {
         return GlobalService.getService(GlobalServiceKeys.PLAYER_PROXY) as IPlayerProxy;
      }
      
      protected function get conductor() : Conductor {
         return GlobalService.getService(GlobalServiceKeys.CONDUCTOR) as Conductor;
      }
      
      protected function get externalInterfaceProxy() : ExternalProxy {
         return GlobalService.getService(GlobalServiceKeys.EXTERNALINTERFACE_PROXY) as ExternalProxy;
      }
      
      protected function init() : void {
      }
      
      public function get isOuterPlayer() : Boolean {
         var _loc1_:IRootData = PlayerConfig.rootData;
         if(_loc1_.winType == "exterior" || _loc1_.winType == "BDskin")
         {
            return true;
         }
         return false;
      }
      
      public function get isLogoLinkout() : Boolean {
         return true;
      }
      
      public function get isPartnerAllowFullScreen() : Boolean {
         return true;
      }
      
      public function gotoVideoSiteURL() : void {
         var _loc3_:String = null;
         if(this.conductor.currentState == ConductorState.VIDEO)
         {
            this.playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PAUSE,{"useraction":true}));
         }
         var _loc1_:String = this.playerProxy.playerData.getJumpURL();
         OpenWindow.open(new URLRequest(_loc1_),"_blank");
         var _loc2_:IRootData = PlayerConfig.rootData;
         if(_loc2_.winType == "exterior" || _loc2_.winType == "BDskin")
         {
            if(OpenWindow.errorInfo != null)
            {
               _loc3_ = OpenWindow.errorInfo;
               this.playerProxy.dispatchEvent(new ReportEvent(ReportEvent.JUMP_URL_ERROR,_loc3_));
            }
         }
      }
      
      public function changeFullScreenMode() : void {
         this.viewManager.changeFullScreen();
      }
   }
}
